package com.zyf.school.manager.service.impl;

import com.zyf.school.manager.dao.HolidayDao;
import com.zyf.school.manager.domain.Holiday;
import com.zyf.school.manager.service.HolidayService;
import com.zyf.school.manager.util.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HolidayServiceImpl implements HolidayService {
    List<Holiday> holidayList;

    @Autowired
    HolidayDao holidayDao;

    @Override
    public void save(Holiday holiday) {
        holidayDao.insert(holiday);
    }

    @Override
    public List<Holiday> query(int startIndex, int pageSize) {
        PageBean page = new PageBean();
        page.setStartIndex(startIndex);
        page.setPageSize(pageSize);
        return holidayDao.queryPage(startIndex,pageSize);
    }

    @Override
    public void deleteById(int id) {
        holidayDao.deleteById(id);
    }

    @Override
    public int count() {
        return holidayDao.selectCount(null);
    }
}
